#include<iostream>
#include<string>
using namespace std;
typedef long long LL;
const int N = 2e5 + 10;
const LL mod = 1e9 + 7;
string s;
LL f[N][10];
int a[N];
int main()
{
	cin >> s;
	int n = s.size();
	for (int i = 0; i < n; i++) {
		int k = s[i] - '0';
		a[i + 1] = k;
		f[i + 1][k % 9]++;
	}
	for (int i = 1; i <= n; i++) {
		for (int j = 0; j < 9; j++) {
			int k = (a[i] + j) % 9;
			f[i][k] = (f[i][k] + f[i - 1][j] + f[i - 1][k]) % mod;
			f[i][k] %= mod;
			cout << "i==" << i << endl;
			cout << "j==" << j << endl;
			cout << "k==" << k << endl;
			cout << f[i][k] << endl;
		}
	}
	cout << f[n][0] % mod << endl;
	return 0;
}